class sieve_of_eratosthenes {
	public static void main(String[] args)
	{
		final int limit = 99999;
        int[] sievearr = new int[limit];
        int[] primenumbers = new int[limit];
        int primepos = 0;
        int step;
        for (int i = 2; i < limit+2; i++)
                sievearr[i-2] = i;
        for (int i = 0; i < limit; i++)
        {
                if (sievearr[i] == 0)
                        continue;
                step = sievearr[i];
                for (int x = i+step; x < limit; x += step)
                {
                        if (sievearr[x] != 0)
                                sievearr[x] = 0;
                }
        }
        for (int i = 0; i < limit; i++)
        {
                if (sievearr[i] != 0)
                {
                        primenumbers[primepos] = sievearr[i];
                        primepos++;
                }
        }
		System.out.println(primenumbers[primepos-1]);
	}
}